package ClassDef;

public class Fridge {

    private int heightInCM;
    private Elephant elephant;
    private Lion lion;

    /**
     * 实例方法
     * 对象就是实例
     */
    void printFridgeInfo() {
        // int heightInCM = 10;
        System.out.printf("%d厘米高的冰箱中，保存了一个%d厘米高的大象\n", heightInCM, elephant.getHeightInCM());
    }

    public int getHeightInCM() {
        return heightInCM;
    }

    public void setHeightInCM(int heightInCM) {
        this.heightInCM = heightInCM;
    }

    public Elephant getElephant() {
        return elephant;
    }

    public void setElephant(Elephant elephant) {
        this.elephant = elephant;
    }

    public void store(Elephant elephant) {
        if (this.lion != null || this.elephant != null) {
            System.out.println("冰箱已经满了");
        } else
            this.elephant = elephant;
    }

    public void store(Lion lion) {
        if (this.lion != null || this.elephant != null) {
            System.out.println("冰箱已经满了");
        } else
            this.lion = lion;
    }

    public Elephant remove() {
        Elephant temp = elephant;
        elephant = null;
        return temp;
    }

//    public Lion remove() {
//        Lion temp = lion;
//        lion = null;
//        return temp;
//    }

}
